Ext.define('hrm.view.LiuyanForm', {
    extend: 'Ext.Panel',
    xtype: 'liuyanform',
    config: {
        layout: 'card',
        groupByDay: true,
        loadingText: '加载中...'
    },
    initialize: function () {
        this.callParent();
        this.formpanel = new Ext.form.Panel({
            standardSubmit: false,
            items: [
                {
                    xtype: 'toolbar',
                    docked: 'top',
                    layout: { pack: 'left' },
                    items: [
                        {
                            ui: 'back',
                            text: '返回',
                            scope: this,
                            handler: function () {
                                this.getParent().setActiveItem(this.prevCard, {
                                    type: 'slide',
                                    reverse: true,
                                    scope: this,
                                    after: function () {
                                        this.destroy();
                                    }
                                });
                            }
                        },
                        { xtype: 'spacer' },
                        {
                            text: '发送',
                            scope: this,
                            handler: function () {
                                if (this.formpanel.getValues().content == '') {
                                    Ext.Msg.alert('', '请填写内容', Ext.emptyFn);
                                    return;
                                }
                                this.formpanel.submit({
                                    url: server+'/ext/com.cinsea.mobile.ext.HrmAction?action=saveliuyan',
                                    params: {processid: this.processid},
                                    scope: this,
                                    waitMsg: {message: '请稍候...', cls: 'demos-loading'},
                                    success: function (form, result) {
                                        this.prevCard.setProcessid(this.processid);//reload parent store
                                        this.getParent().setActiveItem(this.prevCard, {
                                            type: 'slide',
                                            reverse: true,
                                            scope: this,
                                            after: function () {
                                                this.destroy();
                                            }
                                        });
                                    }})

                            }
                        }

                    ]
                },
                {
                    xtype: 'fieldset',
                    title: '留言',
                    defaults: {
                        labelAlign: 'left',
                        labelWidth: '40%'
                    },
                    items: [
                        {
                            xtype: 'textareafield',
                            label: '内容',
                            height:250,
                            required: true,
                            useClearIcon: true,
                            name: 'content'
                        }
                    ]
                }

            ]

        });
        this.add(this.formpanel);
    },
    setProcessid: function (processid) {
        this.processid = processid;
    },
    setPrevcard: function (prevc) {
        this.prevCard = prevc;
    }
});